package org.example.pcbcircuitboard.config;

import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 注册阿里云OSS对象存储
 */
@Configuration
public class OSSConfig {
    @Value("${aliyun.oss.endpoint}")
    private String ENDPOINT;
    @Value("${aliyun.oss.keyId}")
    private String KEY_ID;
    @Value("${aliyun.oss.keySecret}")
    private String KEY_SECRET;

    /**
     * 注册连接
     * @return ossClient OSS连接客户端
     */
    @Bean
    public OSS ossClient() {
        return new OSSClientBuilder().build(ENDPOINT, KEY_ID, KEY_SECRET);
    }
}
